#include <gtest/gtest.h>

int func()
{
    int *ptr = NULL;
    *ptr = 100;
    return 0;
}

TEST(SimpleTest , DeathTest)
{
    ASSERT_DEATH(func(),"");
}
TEST(SimpleTest , DeathExitTest)
{
    //ASSERT_EXIT(func(),::testing::ExitedWithCode(1),"");
    ASSERT_EXIT(func(),::testing::KilledBySignal(11),"");
}
int main(int argc,char* argv[])
{
    ::testing::InitGoogleTest(&argc,argv);
    return RUN_ALL_TESTS();
}